/**
 * 
 */
package com.yullage.ae.util;

import java.util.Set;

import com.yullage.ae.core.Mind;
import com.yullage.ae.core.Zone;

/**
 * @author Yu-chun Huang
 * 
 */
public class EmpathyEvaluator {
	public static double evaluate(Mind mind1, Mind mind2, Set<String> zoneNames) {
		double sumOfSquares = 0;
		Zone zone1;
		Zone zone2;
		double intensity1;
		double intensity2;

		for (String name : zoneNames) {
			zone1 = mind1.getZonePool().get(name);
			zone2 = mind2.getZonePool().get(name);
			intensity1 = (zone1 != null ? zone1.getIntensity() : 0);
			intensity2 = (zone2 != null ? zone2.getIntensity() : 0);
			sumOfSquares += Math.pow(intensity1 - intensity2, 2);
		}

		return Math.pow(sumOfSquares, 0.5);
	}
}
